import { combineReducers, createStore } from "redux";
import memberReducer, { RDMemberActions, RDOrderActions } from "./memberReducer";


/**合并reducer 好用于取type */
let reducers = { memberReducer };


let margeReducers = combineReducers(reducers);

/**导出store */
export let store = createStore(margeReducers);


/**导出store类型 */
export type RDStore = ReturnType<typeof store.getState>;

/**创建已有的action类型 如果后面有其他的action 则依次增加 比如  RDMemberActions | RDOrderActions */
type RDActions = RDMemberActions;

/**创建action类型 */
export type RDAction<T = any> = { type: RDActions, data: T };
